#include "basic.h"
#include "p2p.h"

// Handles request messages.
void handleRequestMessage(unsigned char * message, struct addressPort senderInfo);

// Create and send a data message to requester if the file is located in local content directory.
void sendDataMessageForLocalContent(unsigned char * filename, struct addressPort senderInfo);

// Create and send a data message to requester if the file is located within the data cache.
void sendDataMessageForDataCache(unsigned char * filename, struct addressPort senderInfo, struct dataCache * dataCacheItem);

// Create and send a try message to requester informing him/her peers this p2p application knows has the requested file.
void sendTryMessage(unsigned char * filename, struct addressPort senderInfo);

// Sends a request message to a peer with given ipAddress and port values.
void sendRequestMessage(unsigned char * filename, unsigned long ipAddress, unsigned short port);